package com.cy.store.controller;


import com.cy.store.entity.District;
import com.cy.store.service.IDistrictService;
import com.cy.store.util.JsonResults;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


import java.util.List;

/**
 * 省市区控制类
 */
@RestController //表示该控制类都以Json格式进行响应
//@Controller
@RequestMapping("district")
public class DistrictController extends BaseController {
    @Autowired
    private IDistrictService districtService;

    //表示district路径后的所有请求都拦截到该方法中
    @RequestMapping({"/",""})
    public JsonResults<List<District>> findByParent(String parent){
        List<District> data = districtService.findByParent(parent);
        return new JsonResults<>(OK,data);
    }

}
